const response = require('../utils/methods/response.js')
// 获取配置文件主机名
const { filesSavePath } = require('../config')

// 上传文件控制器
const uploadController = {
    // 上传图片
    uploadFiles: async (req, res) => {
        try{
            // 返回上传后的完整文件路径
            const responseData = `${filesSavePath}/public/images/century_restaurant/${req.file.filename}`
            response.success(res, responseData)
        } catch(err) {
            response.error(res, err)
        }
    }
}

module.exports = uploadController
